package com.xayy.mgt.mapper;

import cn.kawins.mybatis.BaseMapper;
import com.xayy.mgt.model.NodeTreeInfo;
import com.xayy.mgt.model.dto.NodeInfoDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author Nie
 * @version V1.0
 * @date 2023/8/14 15:15
 */

@Mapper
@Component
public interface NodeInfoMapper extends BaseMapper<NodeTreeInfo> {

    /**
     * 分页查询
     * @param nodeInfoDto 查询参数
     * @return  PageInfo<NodeInfo>
     */
    List<NodeTreeInfo> pageList(NodeInfoDto nodeInfoDto);


    void deleteNodeInfo(Long id);

    /**
     * 获取卫星节点编码数组
     * @param nodeId 节点id
     * @return List<String>
     */
    List<Map<String,Object>> getNodeCodeArray(String nodeId);

    /**
     * 根据父id查询
     */
    @Select("" +
            "SELECT a.* FROM health_xw.node_tree_info a WHERE 1   " +
            "AND a.PARENT_ID=#{parentId} " +
            ";"
    )
    List<NodeTreeInfo> selectByParentId(@Param("parentId") Long parentId);
}
